package org.nerve.data.neo4j.repository;

import org.nerve.data.neo4j.domain.Account;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;

import java.util.List;

/**
 * org.nerve.data.neo4j.repository
 * Created by zengxm on 12/13/2016.
 */
public interface AccountRepository extends GraphRepository<Account>{

	List<Account> findByName(String name);

	Account findBySiteAndUuid(int site, String uuid);

	/**
	 * 获取好友
	 * @param account
	 * @return
	 */
	@Query("MATCH (a:Account)<-[:FRIEND]-(f:Account) WHERE ID(a)={0} RETURN f")
	List<Account> getFriends(Account account);
}